import random

b = [23.386, 14.17, 28.55, 29.871, 22.979, 10.133, 21.958, 22.498, 18.493, 24.614, 27.952, 17.374, 11.3, 13.72, 10.747, 12.689, 12.402, 27.197, 15.073, 11.81, 25.27, 23.598, 20.007, 17.281, 25.986, 19.705, 19.791, 17.132, 26.58, 14.764, 20.305, 10.773, 27.009, 24.129, 14.222, 16.05, 14.022, 20.06, 22.482, 19.154, 23.8, 20.955, 12.474, 11.542, 24.883, 12.151, 27.83, 27.978, 24.993, 29.726, 18.549, 29.279, 26.012, 11.522, 28.665, 16.593, 16.573, 10.299, 27.223, 23.335, 10.399, 11.018, 14.915, 21.436, 12.896, 19.536, 14.887, 18.1, 25.412, 17.132, 24.464, 18.717, 25.085, 23.265, 16.785, 13.283, 16.319, 18.394, 24.921, 20.029, 22.033, 19.279, 12.942, 12.129, 24.883, 26.712, 21.429, 18.485, 29.446, 23.994, 13.567, 17.519, 13.803, 10.163, 19.125, 20.393, 12.601, 12.337, 22.072, 16.573]

# b = []
# for i in range(100):
#     a = random.randint(10000, 30000)/1000
#     b.append(a)
# print(b)

class P():
    def __init__(self):

        # 初始化类的实例，设置初始属性值
        self.bag = 0  # 初始化bag属性为0
        self.sumgu = 0  # 初始化sumgu属性为0
    
    def zy(self, a):
        # zy方法，用于判断某种条件并返回bag的值或False
        # 计算条件：(sumgu * a - bag) / bag > 0.05
        if (self.sumgu*a-self.bag)/self.bag > 0.05:
            return self.bag  # 如果条件成立，返回bag的值
        else:
            return False  # 如果条件不成立，返回False
        
    def zs(self, a):
        # zs方法，用于判断某种条件并返回bag的值或False
        # 计算条件：(sumgu * a - bag) / bag < -0.05
        if (self.sumgu*a-self.bag)/self.bag < -0.05:
            return self.bag  # 如果条件成立，返回bag的值
        else:
            return False  # 如果条件不成立，返回False
        
    def update(self, a):

        # update方法，用于更新bag的值
        self.bag = 11  # 将bag的值设置为11
        
def p(alist):
    pass

def p1(a1, b1, b2, rise):
    # 100 * 0.94 + x * 0.84 == (100 + x) * 0.84 * (1+0.02)
    return ((a1*b1)-a1*b2*(1+rise))/(b2*rise)


a = p1(20000, 0.94, 0.84, 0.02)
print(a)